package com.xm.myapplication.MVP.A.Model.DB;

import com.xm.myapplication.AppApplication;

import java.util.List;

import io.objectbox.Box;

public class ItemDao {
    public static void insertOrUpdateBlogItem(Item newItem) {
        getBlogItemBox().put(newItem);
    }

    public static List<Item> getAll() {
        return getBlogItemBox().getAll();
    }

    public static void delete(long id) {
        getBlogItemBox().remove(id);
    }

    public static void deleteAll() {
        getBlogItemBox().removeAll();
    }

    private static Box<Item> getBlogItemBox() {
        return AppApplication.getInstance().getBoxStore().boxFor(Item.class);
    }
}
